package com.tianya.portal.blog.controller;

import com.tianya.common.web.core.domain.AjaxResult;
import com.tianya.common.web.core.page.TableDataInfo;
import com.tianya.portal.blog.domain.BlogNoteTopic;
import com.tianya.portal.blog.service.IBlogNoteTopicService;
import com.tianya.portal.common.core.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 笔记专题Controller
 * 
 * @author tianya
 * @date 2023-05-01
 */
@RestController
@RequestMapping("/noteTopic")
public class BlogNoteTopicController extends BaseController
{
    @Autowired
    private IBlogNoteTopicService blogNoteTopicService;

    /**
     * 查询笔记专题列表
     */
    @GetMapping("/list")
    public TableDataInfo list(BlogNoteTopic blogNoteTopic)
    {
        startPage();
        List<BlogNoteTopic> list = blogNoteTopicService.selectBlogNoteTopicList(blogNoteTopic);
        return getDataTable(list);
    }
    /**
     * 查询笔记专题集合
     */
    @GetMapping("/listAll")
    public AjaxResult listAll(BlogNoteTopic blogNoteTopic)
    {
        List<BlogNoteTopic> list = blogNoteTopicService.selectBlogNoteTopicList(blogNoteTopic);
        return success(list);
    }

    /**
     * 获取笔记专题详细信息
     */
    @GetMapping(value = "/detail/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(blogNoteTopicService.selectBlogNoteTopicById(id));
    }

}
